<button onclick="move('/car/left')">left</button>
<button onclick="move('/car/right')">right</button>
<br>
<button onclick="move('/car/go')">go</button>
<button onclick="move('/car/back')">back</button>
<br>
<button onclick="move('/car/stop')">stop</button>
<button onclick="cap()">cap</button>
<br>
<img id="last" src="http://hcen.cc:59002/img/get/404.jpg"/>
<script>
    let bb = 'http://hcen.cc:59002'

    function corsFetch(url, callback) {


    }

    function move(ss) {
        fetch(bb + ss)
    }

    function cap() {
        fetch(bb + '/img/cap')
    }

    function getImg() {
        let myHeaders = new Headers({
            'Access-Control-Allow-Origin': '*',
            'Content-Type': 'text/plain'
        });
        fetch(bb + '/img/last', {
            method: 'GET',
            headers: myHeaders,
            mode: 'cors'
        }).then(function (res) {
            return res.json()
        }).then(function (json) {
            let img = document.getElementById('last')
            img.src = bb + '/img/get/' + json
        })
    }

    setInterval(getImg, 1000)
</script>
<style>
    button{
        width: 100px;
        height: 60px;
    }
</style>